package jtech;

import java.awt.Image;
import java.util.HashMap;
import java.util.Map;

import javax.swing.ImageIcon;

public class Images {

	private static Map<String, Image> cache = new HashMap<String, Image>();
	
	public static Image get(String path) {
		if (cache.containsKey(path)) {
			return cache.get(path);
		}
		Image image = new ImageIcon(path).getImage();
		cache.put(path, image);
		return image;
	}
	
	public static void remove(String path) {
		cache.remove(path);
	}
	
	public static void add(String path, Image image) {
		cache.put(path, image);
	}
	
	public static void removeAll() {
		cache.clear();
	}
	
}
